$(document).ready(function() {
                $('#login_btn').click(function() {
                    $.ajax({
                        type: 'POST',
                        url: 'http://127.1.1.1:888/login',
                        data: {
                            'username': $('#username').val(),
                            'password': $('#password').val()
                        },
                        success: function(response) {
                            console.log(response)
//                            debugger
//                            alert("ok")
                            if (response.status == 'success') {

                                // 判断用户的 flag 值，跳转到相应页面
                                if (response.flag == 0) {
                                    window.location.href = './users.html';
                                } else if (response.flag == 1) {
                                    window.location.href = './admin.html';
                                }
                            } else {
                                alert(response.message);
                            }
                        },
                        error: function(response) {
                            console.log(response)
//                            debugger
//                            alert("failed.")
                            alert('Error: ' + error.responseText);
                        }
                    });
                });
            });